import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StrategyRuleSegmentVO, StrategyRuleSegmentForm, StrategyRuleSegmentQuery } from '@/api/device/strategyRuleSegment/types';

/**
 * 查询通行时段列表
 * @param query
 * @returns {*}
 */

export const listStrategyRuleSegment = (query?: StrategyRuleSegmentQuery): AxiosPromise<StrategyRuleSegmentVO[]> => {
  return request({
    url: '/device/strategyRuleSegment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询通行时段详细
 * @param id
 */
export const getStrategyRuleSegment = (id: string | number): AxiosPromise<StrategyRuleSegmentVO> => {
  return request({
    url: '/device/strategyRuleSegment/' + id,
    method: 'get'
  });
};

/**
 * 新增通行时段
 * @param data
 */
export const addStrategyRuleSegment = (data: StrategyRuleSegmentForm) => {
  return request({
    url: '/device/strategyRuleSegment',
    method: 'post',
    data: data
  });
};

/**
 * 修改通行时段
 * @param data
 */
export const updateStrategyRuleSegment = (data: StrategyRuleSegmentForm) => {
  return request({
    url: '/device/strategyRuleSegment',
    method: 'put',
    data: data
  });
};

/**
 * 删除通行时段
 * @param id
 */
export const delStrategyRuleSegment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/device/strategyRuleSegment/' + id,
    method: 'delete'
  });
};
